import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: () => import('../views/Layout.vue'),
      redirect: '/article/manage',
      children: [
        {
          path: 'article/category',
          name: 'articleCategory',
          component: () => import('@/views/article/Category.vue')
        },
        {
          path: 'article/manage',
          name: 'articleManage',
          component: () => import('@/views/article/Article.vue')
        },
        {
          path: 'article/draft',
          name: 'articleDraft',
          component: () => import('@/views/article/ArticleDraft.vue')
        },
        {
          path: 'user/info',
          name: 'userInfo',
          component: () => import('@/views/user/UserInfo.vue')
        },
        {
          path: 'user/avatar',
          name: 'userAvatar',
          component: () => import('@/views/user/UserAvatar.vue')
        },
        {
          path: 'user/resetPwd',
          name: 'userResetPwd',
          component: () => import('@/views/user/UserResetPassword.vue')
        }
      ]
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('@/views/Login.vue')
    }
  ]
})

export default router
